package leecode

func countWords(words1 []string, words2 []string) (result int) {
	hash1 := make(map[string]int)
	hash2 := make(map[string]int)
	for i := 0; i < len(words1); i++ {
		hash1[words1[i]]++
	}
	for i := 0; i < len(words2); i++ {
		hash2[words2[i]]++
	}
	for key, value := range hash1 {
		if value == 1 && hash2[key] == 1 {
			//检测hash2中的key的value是否为1
			result++
		}
	}
	return
}
